package com.example.model.wemedia.pojo;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.Alias;

import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "News", description = "自媒体图文内容信息表")
public class News {
    @Schema(description = "主键")
    @TableId(type = IdType.AUTO)
    private Integer newsId;

    @Schema(description = "自媒体用户ID")
    private Integer userId;

    @Schema(description = "标题")
    private String newsTitle;

    @Schema(description = "图文内容")
    private String newsContent;

    @Schema(description = "文章布局 0无图文章 1单图文章 3多图文章")
    private Short articleType;

    @Schema(description = "图文频道ID")
    private Integer channelId;

    @Schema(description = "标签")
    private String newsLabels;

    @Schema(description = "创建时间")
    private Date createdTime;

    @Schema(description = "提交时间")
    private Date submitedTime;

    @Schema(description = "当前状态 0草稿 1提交（待审核） 2审核失败 3人工审核 4人工审核通过 8审核通过（待发布） 9已发布")
    private Short newsStatus;

    @Schema(description = "定时发布时间，不定时则为空")
    private Date publishTime;

    @Schema(description = "拒绝理由")
    private String newsReason;

    @Schema(description = "发布库文章ID")
    private Long articleId;

    @Schema(description = "封面图片列表")
    private String newsImages;

    @Schema(description = "${column.comment}")
    private Short newsEnable;

    @Alias("NewsStatus")
    public enum NewsStatus{
        NORMAL((short)0),SUBMIT((short)1),FAIL((short)2),ADMIN_AUTH((short)3),ADMIN_SUCCESS((short)4),SUCCESS((short)8),PUBLISHED((short)9);
        final short code;
        NewsStatus(short code){
            this.code = code;
        }
        public short getCode(){
            return this.code;
        }
    }
}

